﻿using SRB.Tg.DrawingStandard;
using SRB.Tg.Operate;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Teigha.DatabaseServices;
using Teigha.Geometry;

namespace SRB.Tg.Model
{
    public class PierBeamRebarLCJ
    {

        List<Tuple<string, eDB, int, double, string, string>> rebarLst = new List<Tuple<string,  eDB, int, double, string, string>>();
        Dictionary<int, int> dicNo = new Dictionary<int, int>();
        List<double>  ArrAlongL;
      
        int N7Half = 0;
        double radius = 0.2;
    
        PierBeamRebarPara beamRebarPara;
        PierPara pierPara;
        //string strDiameter = "%%130";
        string strDiameter = "A";
        string strMainDiameter = "D";
        double N1Dia = 0;
        double N6Dia = 0;
        double NEDia = 0;
        double NSDia = 0;
        double sideT1 =0;
        double side1 = 0;
        double side6 = 0;
        double sideB6 = 0;

        double N1S = 40;
        double N6S = 20;
        double N7S = 170;
        double HT = 0;
        double NetH = 0;
        double capN = 30;
        double capA = 50;

        int N89 = 0,  N1011 = 0;
        double N89Len = 0, N1011Len=0;
        string bridgeId = "";
        public PierBeamRebarLCJ(PierPara para, PierBeamRebarPara beamRPara, string _bridgeId = "")
        {
            bridgeId = _bridgeId;
            pierPara = para;
            //beamRebarPara = pierPara.beamRebar;
            beamRebarPara = beamRPara;
            if(pierPara.beam.beam_h> N1S+ N6S-10)
            {
                N1S = pierPara.beam.beam_h * 0.5 + 20;
                N6S = pierPara.beam.beam_h * 0.5;
            }
            #region 配置钢筋           


            double BeamH = (pierPara.h4 - pierPara.h3) * 100;
            double h = beamRebarPara.concrete_protect_layer + GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1 * 3.5 + GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5;
            HT = h;
            NetH = BeamH -   beamRebarPara.concrete_protect_layer- GeneralRebar.outerDiaNew[beamRebarPara.main_bottom_reinforcement_diameter] * 0.1*0.5 - GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1*0.5 - HT;

           
            ArrAlongL = RebarArrangement.ArrangeT2BRebar(NetH, beamRebarPara.erection_reinforcement_space);  //顺桥向
           
            int n7 = 0;
            for (int i=0;i< ArrAlongL.Count;i++)
            {
                h += ArrAlongL[i];
                if (h> pierPara.beam.beam_h)
                {
                    N7Half = i;
                    break;
                }
            }
            ////#endregion
            #endregion

            switch (beamRebarPara.reinforcement_grade)
            {
                case "HRB300":
                    strDiameter = "A";
                    break;
                case "HRB335":
                    strDiameter = "B";
                    break;
                case "HRB400":
                    strDiameter = "C";
                    break;
                case "HRB500":
                    strDiameter = "D";
                    break;
                case "HRB500E":
                    strDiameter = "D";
                    break;
                case "HRB600E":
                    strDiameter = "E";
                    break;
                case "HRB650E":
                    strDiameter = "F";
                    break;
                case "HRB700":
                    strDiameter = "G";
                    break;
                default:
                    strDiameter = "D";
                    break;
            }
            switch (beamRebarPara.main_reinforcement_grade)
            {
                case "HRB300":
                    strMainDiameter = "A";
                    break;
                case "HRB335":
                    strMainDiameter = "B";
                    break;
                case "HRB400":
                    strMainDiameter = "C";
                    break;
                case "HRB500":
                    strMainDiameter = "D";
                    break;
                case "HRB500E":
                    strMainDiameter = "D";
                    break;
                case "HRB600E":
                    strMainDiameter = "E";
                    break;
                case "HRB650E":
                    strMainDiameter = "F";
                    break;
                case "HRB700":
                    strMainDiameter = "G";
                    break;
                default:
                    strMainDiameter = "D";
                    break;
            }
            N1Dia = GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1;
            N6Dia = GeneralRebar.outerDiaNew[beamRebarPara.main_bottom_reinforcement_diameter] * 0.1;
            NEDia = GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1;
            NSDia = GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1;
            //上部主筋*0.5+箍筋
            sideT1 = Math.Round(NSDia + N1Dia * 0.5, 1) + beamRebarPara.concrete_protect_layer;
            side1 = Math.Round(NEDia+N1Dia * 0.5, 1) + beamRebarPara.concrete_protect_layer;
            side6 = Math.Round(NEDia+N1Dia + N6Dia * 0.5, 1) + beamRebarPara.concrete_protect_layer;
            sideB6 = Math.Round(NSDia  + N6Dia * 0.5, 1) + beamRebarPara.concrete_protect_layer;
        }
 
       
        
        public void PlotElevation(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            int NMid =(int)(beamRebarPara.main_mid_length*0.5 / beamRebarPara.main_w_mid_space);
            int Nside = (int)((pierPara.beam_w*0.5 - side1  - beamRebarPara.main_mid_length*0.5) / beamRebarPara.main_w_side_space);

            Point2d CT = insertPoint;
            Point2d M1 = CT.C2D(0.5 * pierPara.beam_w * 0.5, -25 * scale);
            Point2d pt = insertPoint.C2D(0, -22 * scale);
            Point3d ptDim = pt.C3D(-pierPara.beam_w * 0.5 - 15 * scale);
            //Point3d ptDimL = M1.C3D(-0.5 * pierPara.beam_w*0.5 - 10 * scale);
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint.C2D(-pierPara.beam_w * 0.5*0.5), ref ext, "1/2 立面","", scale);
            double ww = 0.5 * pierPara.beam_w * 0.5;
            #region 盖梁外轮廓绘制
            double ang = Math.Atan(pierPara.beam.slopew / 100);
            double BeamH = (pierPara.h4 - pierPara.h3) * 100;
            List<Point2d> ptLst = new List<Point2d>();
            //ptLst.Add(pt);
            double BeamW = pierPara.beam_w;
            Point2d pt1 = pt.C2D(-(pierPara.beam_w * 0.5), -(pierPara.beam_w * 0.5) * pierPara.beam.slopew * 0.01);
            Point2d pt2 = pt1.C2D(pierPara.beam.beam_h * Math.Sin(ang), -pierPara.beam.beam_h * Math.Cos(ang));
            ptLst.Add(pt);
            ptLst.Add(pt1);
            ptLst.Add(pt2);
            Point2d ptBMid = pt.C2D(0, -(pierPara.h4 - pierPara.h3) * 100);

            Point2d pt60 = ptBMid.C2D(-(pierPara.beam_w * 0.5), -(pierPara.beam.beam_w * Math.Sin(ang)));
            Point2d pt61 = pt1.C2D(BeamH * Math.Sin(ang), -(BeamH * Math.Cos(ang)));
            Point2d pt3 = ptBMid.C2D(-(pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)), -(pierPara.beam_w * 0.5 - pierPara.beam.beam_w * Math.Cos(ang)) * pierPara.beam.slopew * 0.01);
            Point2d pt4 = ptBMid.C2D(-pierPara.column.top_w * 0.5, -(pierPara.column.top_w * 0.5) * pierPara.beam.slopew * 0.01);//墩起点
     
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(ptBMid);
            PLPloter.AddLine(db,pt4, ptBMid.C2D(-pierPara.column.top_w * 0.5, -10 * scale), ref ext, "H墩身");
            PLPloter.CreateBreakLineP(db, ref ext, ptBMid.C2D(-pierPara.column.top_w * 0.5, -10 * scale), ptBMid.C2D(0, -10 * scale), scale, "H细线");
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H墩身", true);


            if (ang == 0)
            {
                DimPloter.DimRot(db, pt1.C3D(), pt.C3D(), pt.C3D(0, 15 * scale), ref ext, 0, scale, "" + pierPara.beam_w + "/2", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt1.C3D(), pt2.C3D(), ptDim.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt2.C3D(), pt3.C3D(), ptDim.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt1.C3D(), pt3.C3D(), ptDim.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimAli(db,pt1.C3D(), pt.C3D(), pt.C3D(0, 15 * scale), ref ext, scale, "B/2=(" + pierPara.beam_w + "/cosα)/2", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimAli(db,pt1.C3D(), pt2.C3D(), ptDim.C3D(), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter,0, false);
                DimPloter.DimAli(db, pt2.C3D(), pt61.C3D(), ptDim.C3D(), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter, 0, false);
                DimPloter.DimAli(db,pt1.C3D(), pt61.C3D(), ptDim.C3D(-5*scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter, 0, false);
            }

            DimPloter.DimRot(db, pt4.C3D(), ptBMid.C3D(), ptBMid.C3D(0, -17 * scale), ref ext, 0, scale, "" + pierPara.column.top_w + "/2", Unit.Centimeter, Unit.Centimeter);
            if (pierPara.beam.slopew != 0)
            {
                DimPloter.DimRot(db, pt3.C3D(), pt4.C3D(), ptBMid.C3D(0, -17 * scale), ref ext, 0, scale, "k", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt3.C3D(), pt3.C3D(-pierPara.beam.beam_w), ptBMid.C3D(0, -25 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            }
            else
            {
                DimPloter.DimRot(db, pt3.C3D(), pt4.C3D(), ptBMid.C3D(0, -17 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
                DimPloter.DimRot(db, pt2.C3D(), pt3.C3D(), ptBMid.C3D(0, -17 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            }

            Point2d ptProtect = MathExtensions.GetPointOnTheLine(pt3, pt2, 4 * scale);
            DimPloter.DimRadius(db,ptProtect.C3D(0, 0), ptProtect.C3D(0, -0.01), 2 * scale, ref ext, scale, "净" + beamRebarPara.concrete_protect_layer);
            #endregion



            #region 钢筋绘制


            #region N1
            PLPloter.AddLine(db,pt.C2D(0, -sideT1), pt1.C2D(side1, -sideT1), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt1.C2D(side1, -sideT1), pt1.C2D(side1, -sideT1- N1S), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C2D(0, -sideT1).C3D(-ww*0.3+ beamRebarPara.main_w_mid_space*0.5), ArrowDirection.South, new List<double>(), new List<double>(), "1", scale, true, 1, 0 * scale);
            double N1Len =Math.Round( pierPara.beam_w - 2 * side1 + N1S*2 -2*GlobalFuncs.CalculateReduction(beamRebarPara.main_top_reinforcement_diameter,90),1);
            Tuple<string, eDB, int, double, string, string> tu = new Tuple<string, eDB, int, double, string, string>("1", beamRebarPara.main_top_reinforcement_diameter, 29, N1Len, N1Len.ToString("0.0"),strMainDiameter);
            rebarLst.Add(tu);
            #endregion

            #region N2
            PLPloter.AddLine(db,pt.C2D(0, -sideT1-N1Dia), pt1.C2D(side1+7.5, -sideT1 - N1Dia), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,pt1.C3D(side1 + 7.5+10*scale, -sideT1 - N1Dia-2.5*scale), ref ext, "N2", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt1.C3D(side1 + 7.5 + 10 * scale, -sideT1 - N1Dia), ArrowDirection.South, new List<double>(), new List<double>(), "2", scale, true, 1, 0 * scale);
            double N2Len = pierPara.beam_w - 2 * side1-7.5*2 ;
            tu = new Tuple<string, eDB, int, double, string, string>("2", beamRebarPara.main_top_reinforcement_diameter, 29, N2Len, N2Len.ToString("0.0"),strMainDiameter);
            rebarLst.Add(tu);
            #endregion

            #region N7
            PLPloter.AddLine(db,ptBMid.C2D(0, sideB6), pt3.C2D(0, sideB6), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt2.C2D(side6), pt3.C2D(0, sideB6), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt2.C2D(side6), pt2.C2D(side6, N6S), ref ext, "H钢筋");
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C2D(0, sideB6).C3D(-ww * 0.3 + beamRebarPara.main_w_mid_space * 0.5), ArrowDirection.North, new List<double>(), new List<double>(), "7", scale, true, 1, 0 * scale);

            Line LineN6 = new Line(pt2.C3D(side6), pt3.C3D(0, sideB6));
   
            #endregion

            double h = HT;

            #region N3,N4,N5,N6
            Line LineN6N = new Line(pt2.C3D(side6 - (N1Dia + N6Dia) * 0.5 * Math.Sin(LineN6.Angle), (N1Dia + N6Dia) * 0.5 * Math.Cos(LineN6.Angle)), pt3.C3D(-(N1Dia + N6Dia) * 0.5 * Math.Sin(LineN6.Angle), sideB6 + (N1Dia + N6Dia) * 0.5 * Math.Cos(LineN6.Angle)));
            //PLPloter.AddLine(db,pt2.C2D(side6-(N1Dia+N6Dia) * 0.5 * Math.Sin(LineN6.Angle), (N1Dia + N6Dia) * 0.5 * Math.Cos(LineN6.Angle)), pt3.C2D(-(N1Dia + N6Dia) * 0.5 * Math.Sin(LineN6.Angle), sideB6 + (N1Dia + N6Dia) * 0.5 * Math.Cos(LineN6.Angle)), ref ext, "H细线");
            Point3d ptN = pt.C3D(-pierPara.column.top_w*0.5+ capA, -h);
            Line lineN3 = new Line(ptN, ptN.C3D(-1,-1));
            Point3d ptN3 = MathExtensions.GetIntersection(lineN3, LineN6N);
            PLPloter.AddLine(db,ptN.C2D(), ptN3.C2D(), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN.C2D(), ptN.C2D(capN), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN3.C2D(), ptN3.C2D(-capN*Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            Point3d ptMid = GeTools.MidPoint(ptN.C3D(), ptN3.C3D());
            //TextPloter.AddDBText(db,ptMid.C3D(), ref ext, "N3", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(capN), TextHorizontalMode.TextCenter);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN3.C3D(-38 * Math.Cos(lineN3.Angle), -38 * Math.Sin(lineN3.Angle)), ArrowDirection.North, new List<double>(), new List<double>(), "3", scale, true, 7, 0 * scale);

            Line lineN3N = new Line( ptN3.C3D(), ptN.C3D());
            double N3Len = Math.Round(capN +capN + Math.Round(lineN3N.Length,1), 1);
            //tu = new Tuple<string, eDB, int, double, string, string>("3", beamRebarPara.main_top_reinforcement_diameter, 20, N3Len, N3Len.ToString("0.0"),strMainDiameter);
            tu = new Tuple<string, eDB, int, double, string, string>("3", beamRebarPara.main_top_reinforcement_diameter, (29-15)*2, N3Len, N3Len.ToString("0.0"), strMainDiameter);
            rebarLst.Add(tu);

            ptN = ptN.C3D(-80);
            Line lineN4 = new Line(ptN, ptN.C3D(-1, -1));
            Point3d ptN4 = MathExtensions.GetIntersection(lineN4, LineN6N);
            PLPloter.AddLine(db,ptN.C2D(), ptN4.C2D(), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN.C2D(), pt.C2D(0, -h), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN4.C2D(), ptN4.C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            ptMid = GeTools.MidPoint(ptN.C3D(), ptN4.C3D());
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN4.C3D(-35 * Math.Cos(lineN4.Angle), -35 * Math.Sin(lineN4.Angle)), ArrowDirection.North, new List<double>(), new List<double>(), "4", scale, true, 7, 0 * scale);

            //TextPloter.AddDBText(db,ptMid.C3D(), ref ext, "N4", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(capN), TextHorizontalMode.TextCenter);

            Line lineN4N = new Line(ptN4.C3D(), ptN.C3D());
            #region 调整前
            //double N4LenS =(pierPara.column.top_w * 0.5 - 40) * 2 + 80 * 2;
            //double N4Len = Math.Round(capN*2 + N4LenS + Math.Round(lineN4N.Length,1)*2, 1);
            ////tu = new Tuple<string, eDB, int, double, string, string>("4", beamRebarPara.main_top_reinforcement_diameter, 10, N4Len, N4Len.ToString("0.0"),strMainDiameter);
            //tu = new Tuple<string, eDB, int, double, string, string>("4", beamRebarPara.main_top_reinforcement_diameter, 15, N4Len, N4Len.ToString("0.0"), strMainDiameter);
            //rebarLst.Add(tu);
            #endregion
            #region 调整后
            //double N4LenS = (pierPara.column.top_w * 0.5 - 40) * 2 + 80 * 2;
            double N4Len = Math.Round(capN + capN + Math.Round(lineN4N.Length, 1), 1);
            //tu = new Tuple<string, eDB, int, double, string, string>("4", beamRebarPara.main_top_reinforcement_diameter, 10, N4Len, N4Len.ToString("0.0"),strMainDiameter);
            tu = new Tuple<string, eDB, int, double, string, string>("4", beamRebarPara.main_top_reinforcement_diameter, 15*2, N4Len, N4Len.ToString("0.0"), strMainDiameter);
            rebarLst.Add(tu);
            #endregion

            ptN = ptN.C3D(-80);
            Line lineN5 = new Line(ptN, ptN.C3D(-1, -1));
            Point3d ptN5 = MathExtensions.GetIntersection(lineN5, LineN6N);
            PLPloter.AddLine(db,ptN.C2D(), ptN5.C2D(), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN.C2D(), pt.C2D(0, -h), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN5.C2D(), ptN5.C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            ptMid = GeTools.MidPoint(ptN.C3D(), ptN5.C3D());
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN5.C3D(-20 * Math.Cos(lineN5.Angle), -20 * Math.Sin(lineN5.Angle)), ArrowDirection.North, new List<double>(), new List<double>(), "5", scale, true, 7, 0 * scale);

            //TextPloter.AddDBText(db,ptMid.C3D(), ref ext, "N5", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(capN), TextHorizontalMode.TextCenter);

            Line lineN5N = new Line(ptN5.C3D(), ptN.C3D());
            double N5LenS = (pierPara.column.top_w * 0.5 - 40) * 2 + 80 * 2 + 80 * 2;
            double N5Len = Math.Round(capN * 2 + N5LenS + Math.Round(lineN5N.Length, 1) * 2, 1);
            //tu = new Tuple<string, eDB, int, double, string, string>("5", beamRebarPara.main_top_reinforcement_diameter, 10, N5Len, N5Len.ToString("0.0"),strMainDiameter);
            tu = new Tuple<string, eDB, int, double, string, string>("5", beamRebarPara.main_top_reinforcement_diameter, 29-15, N5Len, N5Len.ToString("0.0"), strMainDiameter);
            rebarLst.Add(tu);

            ptN = ptN.C3D(-80);
            Line lineN5a = new Line(ptN, ptN.C3D(-1, -1));
            Point3d ptN5a = MathExtensions.GetIntersection(lineN5a, LineN6N);
            PLPloter.AddLine(db,ptN.C2D(), ptN5a.C2D(), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN.C2D(), pt.C2D(0, -h), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptN5a.C2D(), ptN5a.C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            ptMid = GeTools.MidPoint(ptN.C3D(), ptN5a.C3D());
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN5a.C3D(-20 * Math.Cos(lineN5a.Angle), -20 * Math.Sin(lineN5a.Angle)), ArrowDirection.North, new List<double>(), new List<double>(), "6", scale, true, 7, 0 * scale);

            //TextPloter.AddDBText(db,ptMid.C3D(), ref ext, "N5", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(capN), TextHorizontalMode.TextCenter);

            Line lineN5aN = new Line(ptN5a.C3D(), ptN.C3D());
            double N5aLenS = (pierPara.column.top_w * 0.5 - 40) * 2 + 80 * 2 + 80 * 2 + 80 * 2;
            double N5aLen = Math.Round(capN * 2 + N5aLenS + Math.Round(lineN5aN.Length, 1) * 2, 1);
            //tu = new Tuple<string, eDB, int, double, string, string>("5", beamRebarPara.main_top_reinforcement_diameter, 10, N5Len, N5Len.ToString("0.0"),strMainDiameter);
            tu = new Tuple<string, eDB, int, double, string, string>("6", beamRebarPara.main_top_reinforcement_diameter, 15, N5aLen, N5aLen.ToString("0.0"), strMainDiameter);
            rebarLst.Add(tu);

            #endregion
            double N6Len = Math.Round(LineN6.Length * 2 + N6S * 2 + pierPara.beam_w - pierPara.beam.beam_w * 2, 1);
            tu = new Tuple<string, eDB, int, double, string, string>("7", beamRebarPara.main_bottom_reinforcement_diameter, 29, N6Len, N6Len.ToString("0.0"), strMainDiameter);
            rebarLst.Add(tu);
            #region N8,N8a
            //PLPloter.AddLine(db,pt.C2D(0, -h), pt1.C2D(side1, -h), ref ext, "H钢筋");
            List<double> N7SLst = new List<double>();
            List<double> N7aSLst = new List<double>();
            Point2d ptN7 = pt.C2D(0, -h);
            Point2d ptN7a = pt.C2D(0, -h);
            bool isS = false;
            Line LineN7a0=new Line();
            Line LineN7a1 = new Line();
            for (int i = 0; i < ArrAlongL.Count-1; i++)
            {
                h += ArrAlongL[i];
                if (h > pierPara.beam.beam_h)
                {
                    Line LineN7a = new Line(pt.C3D(0, -h), pt1.C3D(side1, -h));
                    Point3d ptOut = MathExtensions.GetIntersection(LineN6, LineN7a);
                    PLPloter.AddLine(db,pt.C2D(0, -h), ptOut.C2D(), ref ext, "H钢筋");
                    if(i< ArrAlongL.Count-1)
                      N7aSLst.Add(ArrAlongL[i]);
                    if (!isS)
                    {
                        ptN7a = pt.C2D(0, -h);
                        isS = true;

                        LineN7a0 = new Line(pt.C3D(0, -h), ptOut.C3D());
                    }
                    if(i== ArrAlongL.Count-1)
                    {
                        LineN7a1 = new Line(pt.C3D(0, -h), ptOut.C3D());
                    }
                }
                else
                {
                    PLPloter.AddLine(db,pt.C2D(0, -h), pt1.C2D(side1, -h), ref ext, "H钢筋");
                    N7SLst.Add(ArrAlongL[i]);
                }
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7a.C2D(0, 0).C3D(-ww * 0.1 + beamRebarPara.main_w_mid_space * 0.5), ArrowDirection.North, N7aSLst, new List<double>(),  "8a", scale, false, 2, 0 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptN7.C2D(0, 0).C3D(-ww * 0.1 + beamRebarPara.main_w_mid_space * 0.5), ArrowDirection.South, N7SLst, new List<double>(), "8", scale, false, 2, 0 * scale);


            double N7LenS =Math.Round( (pierPara.beam_w  - 2*beamRebarPara.concrete_protect_layer-NEDia),1);
            double N7Len = Math.Round(N7LenS + N7S*2 - 2 * GlobalFuncs.CalculateReduction(beamRebarPara.erection_reinforcement_diameter, 90),1);
            tu = new Tuple<string, eDB, int, double, string, string>("8", beamRebarPara.erection_reinforcement_diameter, N7Half*2, N7Len, N7Len.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);

            double N7aLenS =Math.Round( (LineN7a0.Length + LineN7a1.Length),0);
            double N7aLen = N7aLenS + N7S*2;
            tu = new Tuple<string, eDB, int, double, string, string>("8a", beamRebarPara.erection_reinforcement_diameter, (ArrAlongL.Count-1- N7Half) * 2, N7aLen,"均"+ N7aLen.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);
            #endregion

            #region N9,N10,N11,N12
            List<double> N8SLst0 = new List<double>();
            List<double> N10SLst = new List<double>();

          

            double allN89Len = 0;
            Point2d ptN8 = pt.C2D(-allN89Len, -sideT1- beamRebarPara.main_w_side_space * 7.35);
    
            double len = BeamH -  beamRebarPara.concrete_protect_layer-NSDia- sideT1;
          
            PLPloter.AddLine(db,pt.C2D(-allN89Len, -sideT1), pt.C2D(-allN89Len, -sideT1 - len), ref ext, "H钢筋");
            for (int i=0;i< NMid;i++)
            {
                allN89Len += beamRebarPara.main_w_mid_space;
                PLPloter.AddLine(db,pt.C2D(-allN89Len, -sideT1), pt.C2D(-allN89Len, -sideT1 - len), ref ext, "H钢筋");
                N8SLst0.Add(beamRebarPara.main_w_mid_space);
            }
            double n10len1=0, n10len2 = 0;
            for (int i = 0; i < Nside-1; i++)
            {
                allN89Len += beamRebarPara.main_w_side_space;
                if (allN89Len > pt.X - pt3.X)
                {
                    Line LineN10 = new Line(pt.C3D(-allN89Len, -sideT1), pt.C3D(-allN89Len, -sideT1 - len));
                    Point3d ptOut = MathExtensions.GetIntersection(LineN6, LineN10);
                    PLPloter.AddLine(db,pt.C2D(-allN89Len, -sideT1), ptOut.C2D(), ref ext, "H钢筋");
                    N10SLst.Add(beamRebarPara.main_w_side_space);
                    if (allN89Len - beamRebarPara.main_w_side_space <= pt.X - pt3.X)
                    {
                        Line Li1 = new Line(pt.C3D(-allN89Len, -sideT1), ptOut.C3D());
                        n10len1 = Li1.Length;
                    }
                    if(i== Nside - 2)
                    {
                        Line Li1 = new Line(pt.C3D(-allN89Len, -sideT1), ptOut.C3D());
                        n10len2 = Li1.Length;
                    }
                }
                else
                {
                    PLPloter.AddLine(db,pt.C2D(-allN89Len, -sideT1), pt.C2D(-allN89Len, -sideT1 - len), ref ext, "H钢筋");
                    N8SLst0.Add(beamRebarPara.main_w_side_space);
                    if (allN89Len + beamRebarPara.main_w_side_space > pt.X - pt3.X)
                    {
                        ptN8 = pt.C2D(-allN89Len, -sideT1 - beamRebarPara.main_w_side_space * 7.5);
                    }
                }
            }
            List<double> N8SLst = new List<double>();
            for (int i=0;i< N8SLst0.Count;i++)
            {
                N8SLst.Add( N8SLst0[N8SLst0.Count-1-i]);
            }
            RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptN8.C3D(0,0), ArrowDirection.West, new List<double>(), N8SLst,  "9", "10", scale, true, 2, 0 * scale);
            RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, pt.C3D(-allN89Len-beamRebarPara.main_w_side_space, -sideT1 - beamRebarPara.main_w_side_space*5.5), ArrowDirection.East, new List<double>(), N10SLst,  "11", "12", scale, false, 2, 0 * scale);

            DimPloter.DimRot(db, pt.C3D(), pt.C3D(-beamRebarPara.main_mid_length*0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, NMid+"×"+ beamRebarPara.main_w_mid_space, Unit.Centimeter, Unit.Centimeter);
            string s = (0.5 * pierPara.beam_w - (Nside - 1) * beamRebarPara.main_w_side_space- side1- beamRebarPara.main_mid_length * 0.5)+"+"+ (Nside - 1) + "×" + beamRebarPara.main_w_side_space;
            DimPloter.DimRot(db, pt.C3D(-beamRebarPara.main_mid_length * 0.5), pt1.C3D(side1), pt.C3D(0, 10 * scale), ref ext, 0, scale, s, Unit.Centimeter, Unit.Centimeter);
            if(pierPara.beam.slopew>0)
               DimPloter.DimRot(db, pt1.C3D(), pt1.C3D(side1), pt.C3D(0, 10 * scale), ref ext, 0, scale, side1+"+b", Unit.Centimeter, Unit.Centimeter);
            else
                DimPloter.DimRot(db, pt1.C3D(), pt1.C3D(side1), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter,1);

            N89Len = Math.Round(len, 1);
            N89 = N8SLst.Count * 2+1;

            N1011 = N10SLst.Count * 2;
            N1011Len = Math.Round((n10len1 + n10len2) * 0.5+ NSDia, 1);
            #endregion

            #endregion


            DimPloter.AddMark(db,"A", pt.C3D(-pierPara.column.top_w*0.4, 5 * scale), ref ext, scale);
            DimPloter.AddMark(db,"A", ptBMid.C3D(-pierPara.column.top_w * 0.4,  - 5 * scale - 3 * scale), ref ext, scale);

            #region 大样绘制
            #region N1,N2
            Point2d ptS = insertPoint.C2D(0,-ext.L() -1* scale);
            //if(beamRebarPara.main_reinforcement_grade == "HRB650E")
            //    BeamSteelSample.CreateBrokenSteelBarsSample(db, ref ext, ptS.C2D(0, N1S-N6S), pierPara.beam_w*0.5 -side1, N1S, (pierPara.beam_w - 2 * side1) + "/2", N1S.ToString(), strDiameter+((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), "1", N1Len.ToString(), scale, "H钢筋",true);
            //else
                BeamSteelSample.CreateBrokenSteelBarsSample(db, ref ext, ptS.C2D(0, N1S - N6S), pierPara.beam_w * 0.5 - side1, N1S, (pierPara.beam_w - 2 * side1) + "/2", N1S.ToString(), strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), "1", N1Len.ToString(), scale, "H钢筋");

            ptS = ptS.C2D(0,-10*scale);
           // if (beamRebarPara.main_reinforcement_grade == "HRB650E")
           //     BeamSteelSample.CreateStraightSteelBarsSample(db, ref ext, ptS, pierPara.beam_w * 0.5 - side1-7.5,(pierPara.beam_w - 2 * side1 - 7.5*2) + "/2", strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), "2", N2Len.ToString(), scale, "H钢筋", true);
           //else
                BeamSteelSample.CreateStraightSteelBarsSample(db, ref ext, ptS, pierPara.beam_w * 0.5 - side1 - 7.5, (pierPara.beam_w - 2 * side1 - 7.5 * 2) + "/2", strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), "2", N2Len.ToString(), scale, "H钢筋", false);
            #endregion

            #region N7

            double n6h = BeamH - pierPara.beam.beam_h - sideB6;
            double n6w = (pierPara.beam_w - pierPara.beam.beam_w * 2);
            ptS = ptS.C2D(0, -n6h);
            //BeamSteelSample.CreateInflectionSteelBarsSample(db, ref ext, ptS, N6S, 86.9, 309, 270.4, "60", "86.9", "618/2", "270.4", "22", "6", "1306", scale, "H钢筋");
            double ll = Math.Abs(Math.Round(LineN6.EndPoint.X- LineN6.StartPoint.X,1));
            double llh = Math.Abs(LineN6.StartPoint.Y - LineN6.EndPoint.Y);
            PLPloter.AddLine(db,ptS.C2D(0, 0), ptS.C2D(-n6w*0.5, 0), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptS.C2D(-n6w * 0.5, 0), ptS.C2D(-n6w * 0.5 - ll, llh), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptS.C2D(-n6w * 0.5 - ll, llh), ptS.C2D(-n6w * 0.5 - ll, llh).C2D(0, N6S), ref ext, "H钢筋");

            DimPloter.DimRot(db, ptS.C3D(-n6w * 0.5, 0), ptS.C3D(-n6w * 0.5 - ll, llh), ptS.C3D(-n6w * 0.5, 0).C3D(0, -5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, ptS.C3D(-n6w * 0.5, 0), ptS.C3D(-n6w * 0.5 - ll, llh), ptS.C3D(-n6w * 0.5 - ll, llh).C3D( -5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            Point2d ptN6T = GeTools.MidPoint(ptS.C3D(-n6w * 0.5, 0), ptS.C3D(-n6w * 0.5 - ll, llh)).C2D();
            TextPloter.AddDBText(db,ptN6T.C3D(), ref ext, LineN6.Length.ToString("0.0"), scale, 2.5, "SRB.HT", LineN6.Angle, TextHorizontalMode.TextRight);
            TextPloter.AddDBText(db,ptS.C3D(-n6w * 0.5+10*scale, 0), ref ext, n6w+"/2", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextRight);
            TextPloter.AddDBText(db,ptS.C2D(-n6w * 0.5 - ll, llh).C3D(3*scale, N6S*0.5), ref ext, N6S.ToString(), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextRight);
//            if (beamRebarPara.main_reinforcement_grade == "HRB650E")
//                RebarDimPloter.RebarWire650(db, ref ext, ptS.C2D(-n6w * 0.5 + 20 * scale, 0), ptS.C3D(-n6w * 0.5 + 20 * scale, 0).C2D(2 * scale, 5 * scale), "  " + ((int)beamRebarPara.main_bottom_reinforcement_diameter).ToString(), N6Len.ToString("0.0"), "7",strMainDiameter,
//GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            else
                RebarDimPloter.RebarWireNew(db, ref ext, ptS.C2D(-n6w * 0.5 + 20 * scale, 0), ptS.C3D(-n6w * 0.5 + 20 * scale, 0).C2D(2 * scale, 5 * scale), strMainDiameter + ((int)beamRebarPara.main_bottom_reinforcement_diameter).ToString(), N6Len.ToString("0.0"), "7",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            #endregion

            #region N8,N8a
            ptS = ptS.C2D(0,  - 14.5 * scale);
            BeamSteelSample.CreateBrokenSteelBarsSample(db, ref ext, ptS, N7LenS*0.5, N7S, N7LenS + "/2", N7S.ToString(), strDiameter + ((int)beamRebarPara.erection_reinforcement_diameter).ToString(), "8", N7Len.ToString(), scale, "H钢筋");

            ptS = ptS.C2D(0,  - 8.5 * scale);
            BeamSteelSample.CreateBrokenSteelBarsSample(db, ref ext, ptS, N7aLenS * 0.5, N7S, "均" + N7aLenS + "/2", N7S.ToString(), strDiameter + ((int)beamRebarPara.erection_reinforcement_diameter).ToString(), "8a", "均" + N7aLen.ToString(), scale, "H钢筋");

            #endregion

            #region N5,N4,N3,N6
            ptS = ptS.C2D(0, -26.5 * scale);
            double n5ah = Math.Abs(Math.Round(lineN5aN.StartPoint.Y - lineN5aN.EndPoint.Y, 1));
            double n5aw = Math.Abs(Math.Round(lineN5aN.StartPoint.X - lineN5aN.EndPoint.X, 1));
            Point2d p0 = ptS.C2D(-pierPara.column.top_w * 0.5 + capA - 80 * 3);
            Line li1 = PLPloter.AddLine(db,p0, ptS.C2D(), ref ext, "H钢筋");
            Line li2 = PLPloter.AddLine(db,p0.C2D(), p0.C2D(-n5aw, -n5ah), ref ext, "H钢筋");
            PLPloter.AddLine(db,p0.C2D(-n5aw, -n5ah), p0.C2D(-n5aw, -n5ah).C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            Point2d ptN5aT = GeTools.MidPoint(p0.C3D(), p0.C3D(-n5aw, -n5ah)).C2D();
            TextPloter.AddDBText(db,ptN5aT.C3D(), ref ext, lineN5aN.Length.ToString("0.0"), scale, 2.5, "SRB.HT", lineN5aN.Angle, TextHorizontalMode.TextRight);
//            if (beamRebarPara.main_reinforcement_grade == "HRB650E")
//                RebarDimPloter.RebarWire650(db, ref ext, ptN5aT.C2D(), ptN5aT.C3D().C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N5Len.ToString("0.0"), "6", strDiameter,
//GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            else
                RebarDimPloter.RebarWireNew(db, ref ext, ptN5aT.C2D(), ptN5aT.C3D().C2D(2 * scale, -5 * scale), strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N5aLen.ToString("0.0"), "6",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            TextPloter.AddDBText(db,p0.C3D(N5aLenS * 0.25, 0), ref ext, N5aLenS + "/2", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextLeft);
            ptN5aT = GeTools.MidPoint(p0.C3D(-n5aw, -n5ah), p0.C2D(-n5aw, -n5ah).C3D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle))).C2D();
            TextPloter.AddDBText(db,ptN5aT.C3D(), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", LineN6.Angle, TextHorizontalMode.TextCenter, TextVerticalMode.TextBottom);

            DimPloter.DimRot(db, ptS.C3D(), p0.C3D(), ptS.C3D().C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, p0.C3D(), p0.C3D(-n5aw, -n5ah), p0.C3D(-n5aw, -n5ah).C3D().C3D(-6 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimAng(db,li1, li2, p0.C3D(0, -4 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);


            ptS = ptS.C2D(0, -20 * scale);
            double n5h = Math.Abs(Math.Round(lineN5N.StartPoint.Y - lineN5N.EndPoint.Y, 1));
            double n5w = Math.Abs(Math.Round(lineN5N.StartPoint.X - lineN5N.EndPoint.X, 1));
            p0 = ptS.C2D(-pierPara.column.top_w * 0.5 + capA - 80*2);
            li1 = PLPloter.AddLine(db,p0, ptS.C2D(), ref ext, "H钢筋");
            li2 = PLPloter.AddLine(db,p0.C2D(), p0.C2D(-n5w, -n5h), ref ext, "H钢筋");
            PLPloter.AddLine(db,p0.C2D(-n5w, -n5h), p0.C2D(-n5w, -n5h).C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            Point2d ptN5T = GeTools.MidPoint(p0.C3D(), p0.C3D(-n5w, -n5h)).C2D();
            TextPloter.AddDBText(db,ptN5T.C3D(), ref ext, lineN5N.Length.ToString("0.0"), scale, 2.5, "SRB.HT", lineN5N.Angle, TextHorizontalMode.TextRight);
//            if (beamRebarPara.main_reinforcement_grade == "HRB650E")
//                RebarDimPloter.RebarWire650(db, ref ext, ptN5T.C2D(), ptN5T.C3D().C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N5Len.ToString("0.0"), "5", strDiameter,
//GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            else
                RebarDimPloter.RebarWireNew(db, ref ext, ptN5T.C2D(), ptN5T.C3D().C2D(2 * scale, -5 * scale), strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N5Len.ToString("0.0"), "5",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            TextPloter.AddDBText(db,p0.C3D(N5LenS * 0.25, 0), ref ext, N5LenS + "/2", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextLeft);
            ptN5T = GeTools.MidPoint(p0.C3D(-n5w, -n5h), p0.C2D(-n5w, -n5h).C3D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle))).C2D();
            TextPloter.AddDBText(db,ptN5T.C3D(), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", LineN6.Angle, TextHorizontalMode.TextCenter,TextVerticalMode.TextBottom);

            DimPloter.DimRot(db, ptS.C3D(), p0.C3D(), ptS.C3D().C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, p0.C3D(), p0.C3D(-n5w, -n5h), p0.C3D(-n5w, -n5h).C3D().C3D(-6 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimAng(db,li1, li2, p0.C3D(0, -4 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);


            ptS = ptS.C2D(0, -20 * scale);
            double n4h = Math.Abs(Math.Round(lineN4N.StartPoint.Y - lineN4N.EndPoint.Y, 1));
            double n4w = Math.Abs(Math.Round(lineN4N.StartPoint.X - lineN4N.EndPoint.X, 1));
            p0 = ptS.C2D(-pierPara.column.top_w * 0.5 + capA - 80);
            //li1 = PLPloter.AddLine(db,p0, ptS.C2D(), ref ext, "H钢筋");
            li1 = PLPloter.AddLine(db, p0, p0.C2D(capN), ref ext, "H钢筋");
            li2 = PLPloter.AddLine(db,p0.C2D(), p0.C2D(-n4w, -n4h), ref ext, "H钢筋");
            PLPloter.AddLine(db,p0.C2D(-n4w, -n4h), p0.C2D(-n4w, -n4h).C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            Point2d ptN4T = GeTools.MidPoint(p0.C3D(), p0.C3D(-n4w, -n4h)).C2D();
            TextPloter.AddDBText(db,ptN4T.C3D(), ref ext, lineN4N.Length.ToString("0.0"), scale, 2.5, "SRB.HT", lineN4N.Angle, TextHorizontalMode.TextRight);
//            if (beamRebarPara.main_reinforcement_grade == "HRB650E")
//                RebarDimPloter.RebarWire650(db, ref ext, ptN4T.C2D(), ptN4T.C3D().C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N4Len.ToString("0.0"), "4", strDiameter,
//GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            else
                RebarDimPloter.RebarWireNew(db, ref ext, ptN4T.C2D(), ptN4T.C3D().C2D(2 * scale, -5 * scale), strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N4Len.ToString("0.0"), "4", 
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            //TextPloter.AddDBText(db,p0.C3D(N4LenS*0.25, 0), ref ext, N4LenS+ "/2", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextLeft);
            TextPloter.AddDBText(db, p0.C3D(20, 0), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter, TextVerticalMode.TextBottom);
            ptN4T = GeTools.MidPoint(p0.C3D(-n4w, -n4h), p0.C2D(-n4w, -n4h).C3D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle))).C2D();
            TextPloter.AddDBText(db,ptN4T.C3D(), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", LineN6.Angle, TextHorizontalMode.TextCenter, TextVerticalMode.TextBottom);

            DimPloter.DimRot(db, ptS.C3D(), p0.C3D(), ptS.C3D().C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, p0.C3D(), p0.C3D(-n4w, -n4h), p0.C3D(-n4w, -n4h).C3D(-6 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimAng(db,li1, li2, p0.C3D(0, -4 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);

            ptS = ptS.C2D(0, -20 * scale);
            double n3h =Math.Abs(Math.Round( lineN3N.StartPoint.Y - lineN3N.EndPoint.Y ,1));
            double n3w = Math.Abs(Math.Round(lineN3N.StartPoint.X - lineN3N.EndPoint.X, 1));
            p0 = ptS.C2D(-pierPara.column.top_w * 0.5 + capA);
            li1 = PLPloter.AddLine(db,p0, p0.C2D(capN), ref ext, "H钢筋");
            li2 = PLPloter.AddLine(db,p0.C2D(), p0.C2D(-n3w, -n3h), ref ext, "H钢筋");
            PLPloter.AddLine(db,p0.C2D(-n3w, -n3h), p0.C2D(-n3w, -n3h).C2D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle)), ref ext, "H钢筋");
            Point2d ptN3T = GeTools.MidPoint(p0.C3D(), p0.C3D(-n3w, -n3h)).C2D();
            TextPloter.AddDBText(db,ptN3T.C3D(), ref ext, lineN3N.Length.ToString("0.0"), scale, 2.5, "SRB.HT", lineN3N.Angle, TextHorizontalMode.TextRight);
            //            RebarDimPloter.RebarWireNew(db, ref ext, ptN3T.C2D(), ptN3T.C3D().C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N3Len.ToString("0.0"), "3",
            //GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            if (beamRebarPara.main_reinforcement_grade == "HRB650E")
//                RebarDimPloter.RebarWire650(db, ref ext, ptN3T.C2D(), ptN3T.C3D().C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N3Len.ToString("0.0"), "3", strDiameter,
//GeTools.DegreeToRadian(0), Extensions.curFont, scale);
//            else
                RebarDimPloter.RebarWireNew(db, ref ext, ptN3T.C2D(), ptN3T.C3D().C2D(2 * scale, -5 * scale), strMainDiameter + ((int)beamRebarPara.main_top_reinforcement_diameter).ToString(), N3Len.ToString("0.0"), "3", 
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            TextPloter.AddDBText(db,p0.C3D(20, 0), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter, TextVerticalMode.TextBottom);
            ptN3T = GeTools.MidPoint(p0.C3D(-n3w, -n3h), p0.C2D(-n3w, -n3h).C3D(-capN * Math.Cos(LineN6.Angle), -capN * Math.Sin(LineN6.Angle))).C2D();
            TextPloter.AddDBText(db,ptN3T.C3D(), ref ext, capN.ToString(), scale, 2.5, "SRB.HT", LineN6.Angle, TextHorizontalMode.TextCenter, TextVerticalMode.TextBottom);

            DimPloter.DimRot(db, ptS.C3D(), p0.C3D(), ptS.C3D().C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, p0.C3D(), p0.C3D(-n3w, -n3h), p0.C3D(-n3w, -n3h).C3D(-6 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimAng(db,li1, li2, p0.C3D(0, -4 * scale), ref ext, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #endregion


            PLPloter.AddScaleLine(db, pt.C2D(0, 20*scale), ptS.C2D(0, -n3h), ref ext, "H中心线",(int)scale*2);
        }

        public void PlotElevationA(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            radius = radius * scale;
            double LA = 0;
            ext = new Extents2d(insertPoint, insertPoint);
            //List<Point2d> ptList = new List<Point2d>();
            Point2d CT = insertPoint;
            Point2d M1 = CT.C2D(0, -25 * scale);
            Point2d pt = insertPoint.C2D(0, -22 * scale);
            Point3d ptDim = M1.C3D(0, 8 * scale);
            Point3d ptDimR = M1.C3D(0.5 * pierPara.beam_l + 20 * scale);
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "A-A", "", scale);
            double BeamH = (pierPara.h4 - pierPara.h3) * 100;

            #region 截面外轮廓
            PLPloter.AddPloy4(db, pt, pierPara.beam_l * 0.5, pierPara.beam_l * 0.5, BeamH, ref ext, "H墩身");

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH), pt.C3D(pierPara.beam_l * 0.5, -BeamH), pt.C3D(0, -BeamH - 21.5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(pierPara.beam_l * 0.5, 0), pt.C3D(pierPara.beam_l * 0.5, -BeamH), ptDimR.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            PLPloter.AddLine(db,pt.C2D(-pierPara.column.top_l * 0.5, -BeamH), pt.C2D(-pierPara.column.top_l * 0.5, -BeamH - 15 * scale), ref ext, "H墩身");
            PLPloter.CreateBreakLineP(db, ref ext, pt.C2D(-pierPara.column.top_l * 0.5, -BeamH - 15 * scale), pt.C2D(pierPara.column.top_l * 0.5, -BeamH - 15 * scale), scale, "H细线");
            PLPloter.AddLine(db,pt.C2D(pierPara.column.top_l * 0.5, -BeamH), pt.C2D(pierPara.column.top_l * 0.5, -BeamH - 15 * scale), ref ext, "H墩身");
            #endregion

            #region 钢筋

            double sideL = Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1 * 0.5 + GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1), 1);
            double sideLT = sideT1;//  Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideLB = sideB6;// Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_bottom_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideS = Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5) + (GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideL1 = Math.Round(beamRebarPara.concrete_protect_layer + GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5, 1);
            double sideL2 = Math.Round(beamRebarPara.concrete_protect_layer + GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1 * 0.5, 1);

            double hh = BeamH - beamRebarPara.concrete_protect_layer * 2;
            PLPloter.AddPloy4(db, pt.C2D(0, -beamRebarPara.concrete_protect_layer), pierPara.beam_l * 0.5 - sideS, pierPara.beam_l * 0.5 - sideS, hh, ref ext, "H钢筋");

            double NetL = pierPara.beam_l - sideL * 2;
            //ArrAlongL = RebarArrangement.ArrangeT2BRebar(NetL, beamRebarPara.erection_reinforcement_space);  //顺桥向

            #region N1
            List<Point3d> ptTLst = new List<Point3d>();
            List<double> topSpaceTLst = new List<double>();
            string topString = "";

            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT - N1Dia), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT - N1Dia * 2), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT - N1Dia * 3), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -sideLT), pt.C3D(-pierPara.beam_l * 0.5 + sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.beam_l * 0.5, -sideLT), pt.C3D(pierPara.beam_l * 0.5 - sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5 + sideL, -sideLT), pt.C3D(pierPara.beam_l * 0.5 - sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, topString, Unit.Centimeter, Unit.Centimeter, 1);
            Point2d ptM = ptDim.C2D(-topSpaceTLst.Count * 2.5 * scale * 0.5, 15 * scale);
            double len = 0;
            for (int i = 0; i < ptTLst.Count; i++)
            {
                len += 2.5 * scale;
                PLPloter.AddPloy4(db, ptM.C2D(len), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -1.25 * scale), ref ext, "1", scale, 2.5*0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -2.5 * scale - 1.25 * scale), ref ext, "2", scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale * 2), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                string txt = "6";
                if (i <= ptTLst.Count * 0.5)
                {
                    if (i % 2 == 0)
                        txt = "6";
                    else
                        txt = "5";

                }
                if (i > ptTLst.Count * 0.5)
                {
                    if ((ptTLst.Count - 1 - i) % 2 == 0)
                        txt = "6";
                    else
                        txt = "5";

                }
                TextPloter.AddDBText(db,ptM.C3D(len, -2.5 * scale*2 - 1.25 * scale), ref ext, txt, scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale * 2), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale * 3), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                txt = "4";
                if (i <= ptTLst.Count * 0.5)
                {
                    if (i % 2 == 0)
                        txt = "4";
                    else
                        txt = "3";
                
                }
                if (i > ptTLst.Count * 0.5)
                {
                    if ((ptTLst.Count - 1 - i) % 2 == 0)
                        txt = "4";
                    else
                        txt = "3";
                 
                }
                TextPloter.AddDBText(db,ptM.C3D(len, -2.5 * scale * 3 - 1.25 * scale), ref ext, txt, scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
            }
            #endregion
            #region N7
            List<Point3d> ptLst = new List<Point3d>();
            List<double> topSpaceLst = new List<double>();
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -BeamH + sideLB), radius, NetL, NetL, 28, 0, 0, out ptLst, out topSpaceLst, out topString, eDirection.E_TOP);

            //SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptLst, "6", ptLst.Count / 3, ptLst.Count / 4, scale, false, 4 * scale);
            ptM = pt.C2D(-topSpaceLst.Count * 2.5 * scale * 0.5, -BeamH-25 * scale);
            len = 0;
            for (int i = 0; i < ptLst.Count; i++)
            {
                len += 2.5 * scale;
                PLPloter.AddPloy4(db, ptM.C2D(len), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -1.25 * scale), ref ext, "7", scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);               
            }
            #endregion

            #region N9
            TextPloter.AddDBText(db,pt.C2D(-pierPara.beam_l * 0.5 + sideL, -beamRebarPara.concrete_protect_layer).C3D(3 * scale, -hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[8].C2D(radius, -(sideLT- beamRebarPara.concrete_protect_layer)), ptLst[8].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[8].C3D(radius, -radius + hh * 0.3), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[ptLst.Count - 9].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[ptLst.Count - 9].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[ptLst.Count - 9].C3D(-radius, -radius + hh * 0.3), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,pt.C2D(pierPara.beam_l * 0.5 - sideL, -beamRebarPara.concrete_protect_layer).C3D(-0 * scale, -hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            #endregion

            #region N10

            PLPloter.AddLine(db,ptLst[4].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[4].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[4].C3D(-radius, -radius + hh * 0.7), ref ext, "10", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[12].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[12].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[12].C3D(-radius, -radius + hh * 0.7), ref ext, "10", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[16].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[16].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[16].C3D(radius, -radius + hh * 0.7), ref ext, "10", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[ptLst.Count - 5].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[ptLst.Count - 5].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[ptLst.Count - 5].C3D(radius, -radius + hh * 0.7), ref ext, "10", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);

            #endregion

            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideS + radius, -BeamH + sideB6),
            radius, ArrAlongL, scale, 0, out reLLst, false, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(pierPara.beam_l * 0.5 - sideS - radius, -BeamH + sideB6),
            radius, ArrAlongL, scale, 0, out reRLst, false, false, false);

            List<Point3d> lstN7 = new List<Point3d>();
            List<Point3d> lstN7a = new List<Point3d>();
            for (int i = 0; i < reLLst.Count; i++)
            {
                if (i < reLLst.Count - N7Half)
                {
                    lstN7a.Add(reLLst[i]);
                }
                else
                {
                    lstN7.Add(reLLst[i]);
                }
            }
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, lstN7, "8", lstN7.Count / 4, lstN7.Count / 4, scale, false, 5 * scale);
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, lstN7a, "8a", lstN7a.Count / 4, lstN7a.Count / 4, scale, false, 5 * scale);

            lstN7 = new List<Point3d>();
            lstN7a = new List<Point3d>();
            for (int i = 0; i < reRLst.Count; i++)
            {
                if (i < reRLst.Count - N7Half)
                {
                    lstN7a.Add(reRLst[i]);
                }
                else
                {
                    lstN7.Add(reRLst[i]);
                }
            }
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_RIGHT, lstN7, "8", lstN7.Count / 4, lstN7.Count / 4, scale, false, 5 * scale);
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_RIGHT, lstN7a, "8a", lstN7a.Count / 4, lstN7a.Count / 4, scale, false, 5 * scale);


            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, 0), pt.C3D(-pierPara.beam_l * 0.5, -sideLT), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH), pt.C3D(-pierPara.beam_l * 0.5, -BeamH + sideLB), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            string s = ArrAlongL[0].ToString("0.0") + "+" + (ArrAlongL.Count - 2) + "×" + ArrAlongL[1] + "+" + Math.Round(BeamH - Math.Round(ArrAlongL[0], 1) - (ArrAlongL.Count - 2) * ArrAlongL[1] - sideLT - sideLB, 1);

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH + sideLB), pt.C3D(-pierPara.beam_l * 0.5, -sideLT), ptDimR.C3D(-5 * scale), ref ext, 90, scale, s, Unit.Centimeter, Unit.Centimeter, 1);
            #endregion

            #region 大样

            #region N9,N10
            //double diaN8 = GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1;
            double diaN8 = ((int)beamRebarPara.stirrup_reinforcement_diameter) * 0.1;
            Point2d ptS = pt.C2D(0, -ext.L() - 10 * scale);
            double le = pierPara.beam_l * 0.5 - sideS;
            double N810w =Math.Round( topSpaceLst[0] + topSpaceLst[1] * 7 + N1Dia+NSDia,1);
            double N911w = Math.Round(topSpaceLst[1] * 12 + N1Dia + NSDia, 1);
            double N8Len = N810w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N89Len*2-3* GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter,90);
            Tuple<string, eDB, int, double, string, string> tu = new Tuple<string, eDB, int, double, string, string>("9", beamRebarPara.stirrup_reinforcement_diameter, N89*2, N8Len, N8Len.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);
            double N9Len = N911w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N89Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("10", beamRebarPara.stirrup_reinforcement_diameter, N89 * 2, N9Len, N9Len.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);

            Point2d ptCenter = ptS.C2D(-le + N810w * 0.5);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-1.5*scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 3), ptCenter.C2D(N810w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -3), ptCenter.C2D(N810w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0,-N89Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N810w*0.5, -N89Len*0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(-2 * scale, -N89Len), ptCenter.C3D(0, -N89Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N8Len.ToString("0.0"), "9",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w * 0.5 + N911w * 0.5, 15 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 3), ptCenter.C2D(N911w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -3), ptCenter.C2D(N911w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N89Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N89Len * 0.3), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N9Len.ToString("0.0"), "10",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w + N911w / 3.0 + N911w * 0.5, 8 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 3), ptCenter.C2D(N911w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -3), ptCenter.C2D(N911w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2 * scale, -N89Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N9Len.ToString("0.0"), "10",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);


            ptCenter = ptS.C2D(-le + N810w * 1.5 + N911w);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 3), ptCenter.C2D(N810w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -3), ptCenter.C2D(N810w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N89Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N89Len), ptCenter.C3D(0, -N89Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N8Len.ToString("0.0"), "9",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            #endregion

            #region N11,12
            ptS = pt.C2D(0, -ext.L() - 10 * scale);

            double N10Len = N810w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N1011Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("11", beamRebarPara.stirrup_reinforcement_diameter, N1011 * 2, N10Len,"均"+ N10Len.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);
            double N11Len = N911w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N1011Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("12", beamRebarPara.stirrup_reinforcement_diameter, N1011 * 2, N11Len, "均" + N11Len.ToString("0.0"),strDiameter);
            rebarLst.Add(tu);
            ptCenter = ptS.C2D(-le + N810w * 0.5);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5-3), ptCenter.C2D(N810w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -3), ptCenter.C2D(N810w * 0.5,-3).C2D(-1.5* scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N1011Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N1011Len), ptCenter.C3D(0, -N1011Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N10Len.ToString("0.0"), "11",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w * 0.5 + N911w * 0.5, 15 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 3), ptCenter.C2D(N911w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -3), ptCenter.C2D(N911w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2*scale, -N1011Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N11Len.ToString("0.0"), "12",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w + N911w / 3.0 + N911w * 0.5, 8 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 3), ptCenter.C2D(N911w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -3), ptCenter.C2D(N911w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2 * scale, -N1011Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N11Len.ToString("0.0"), "12",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);


            ptCenter = ptS.C2D(-le + N810w * 1.5 + N911w);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 3), ptCenter.C2D(N810w * 0.5 - 3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -3), ptCenter.C2D(N810w * 0.5, -3).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N1011Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N1011Len), ptCenter.C3D(0, -N1011Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N10Len.ToString("0.0"), "11",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            #endregion

            #endregion
        }
        

        /// <summary>
        /// 顶部三层
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="scale"></param>
        public void PlotElevationA_BAK(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            radius = radius * scale;
            double LA = 0;
            ext = new Extents2d(insertPoint, insertPoint);
            //List<Point2d> ptList = new List<Point2d>();
            Point2d CT = insertPoint;
            Point2d M1 = CT.C2D(0, -25 * scale);
            Point2d pt = insertPoint.C2D(0, -22 * scale);
            Point3d ptDim = M1.C3D(0, 8 * scale);
            Point3d ptDimR = M1.C3D(0.5 * pierPara.beam_l + 20 * scale);
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "A-A", "", scale);
            double BeamH = (pierPara.h4 - pierPara.h3) * 100;

            #region 截面外轮廓
            PLPloter.AddPloy4(db, pt, pierPara.beam_l * 0.5, pierPara.beam_l * 0.5, BeamH, ref ext, "H墩身");

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH), pt.C3D(pierPara.beam_l * 0.5, -BeamH), pt.C3D(0, -BeamH - 21.5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(pierPara.beam_l * 0.5, 0), pt.C3D(pierPara.beam_l * 0.5, -BeamH), ptDimR.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            PLPloter.AddLine(db,pt.C2D(-pierPara.column.top_l * 0.5, -BeamH), pt.C2D(-pierPara.column.top_l * 0.5, -BeamH - 15 * scale), ref ext, "H墩身");
            PLPloter.CreateBreakLineP(db, ref ext, pt.C2D(-pierPara.column.top_l * 0.5, -BeamH - 15 * scale), pt.C2D(pierPara.column.top_l * 0.5, -BeamH - 15 * scale), scale, "H细线");
            PLPloter.AddLine(db,pt.C2D(pierPara.column.top_l * 0.5, -BeamH), pt.C2D(pierPara.column.top_l * 0.5, -BeamH - 15 * scale), ref ext, "H墩身");
            #endregion

            #region 钢筋

            double sideL = Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1 * 0.5 + GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1 * 0.5 + GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideLT = sideT1;//  Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_top_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideLB = sideB6;// Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.main_bottom_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideS = Math.Round(beamRebarPara.concrete_protect_layer + (GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5) + (GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1 * 0.5), 1);
            double sideL1 = Math.Round(beamRebarPara.concrete_protect_layer + GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1 * 0.5, 1);
            double sideL2 = Math.Round(beamRebarPara.concrete_protect_layer + GeneralRebar.outerDiaNew[beamRebarPara.erection_reinforcement_diameter] * 0.1 * 0.5, 1);

            double hh = BeamH - beamRebarPara.concrete_protect_layer * 2;
            PLPloter.AddPloy4(db, pt.C2D(0, -beamRebarPara.concrete_protect_layer), pierPara.beam_l * 0.5 - sideS, pierPara.beam_l * 0.5 - sideS, hh, ref ext, "H钢筋");

            double NetL = pierPara.beam_l - sideL * 2;
            //ArrAlongL = RebarArrangement.ArrangeT2BRebar(NetL, beamRebarPara.erection_reinforcement_space);  //顺桥向

            #region N1
            List<Point3d> ptTLst = new List<Point3d>();
            List<double> topSpaceTLst = new List<double>();
            string topString = "";

            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT - N1Dia), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -sideLT - N1Dia * 2), radius, NetL, NetL, 28, 0, 0, out ptTLst, out topSpaceTLst, out topString, eDirection.E_TOP);

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -sideLT), pt.C3D(-pierPara.beam_l * 0.5 + sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.beam_l * 0.5, -sideLT), pt.C3D(pierPara.beam_l * 0.5 - sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5 + sideL, -sideLT), pt.C3D(pierPara.beam_l * 0.5 - sideL, -sideLT), ptDim.C3D(), ref ext, 0, scale, topString, Unit.Centimeter, Unit.Centimeter, 1);
            Point2d ptM = ptDim.C2D(-topSpaceTLst.Count * 2.5 * scale * 0.5, 15 * scale);
            double len = 0;
            for (int i = 0; i < ptTLst.Count; i++)
            {
                len += 2.5 * scale;
                PLPloter.AddPloy4(db, ptM.C2D(len), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -1.25 * scale), ref ext, "1", scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -2.5 * scale - 1.25 * scale), ref ext, "2", scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
                PLPloter.AddPloy4(db, ptM.C2D(len, -2.5 * scale * 2), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                string txt = "4";
                if (i <= ptTLst.Count * 0.5)
                {
                    if (i % 3 == 0)
                        txt = "4";
                    else if (i % 3 == 1)
                        txt = "3";
                    else
                        txt = "5";
                }
                if (i > ptTLst.Count * 0.5)
                {
                    if ((ptTLst.Count - 1 - i) % 3 == 0)
                        txt = "4";
                    else if ((ptTLst.Count - 1 - i) % 3 == 1)
                        txt = "3";
                    else
                        txt = "5";
                }
                TextPloter.AddDBText(db,ptM.C3D(len, -2.5 * scale * 2 - 1.25 * scale), ref ext, txt, scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
            }
            #endregion
            #region N6
            List<Point3d> ptLst = new List<Point3d>();
            List<double> topSpaceLst = new List<double>();
            SteelBarPileCap.CreateAvgCircleHatchListByCount(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideL, -BeamH + sideLB), radius, NetL, NetL, 28, 0, 0, out ptLst, out topSpaceLst, out topString, eDirection.E_TOP);

            //SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptLst, "6", ptLst.Count / 3, ptLst.Count / 4, scale, false, 4 * scale);
            ptM = pt.C2D(-topSpaceLst.Count * 2.5 * scale * 0.5, -BeamH - 25 * scale);
            len = 0;
            for (int i = 0; i < ptLst.Count; i++)
            {
                len += 2.5 * scale;
                PLPloter.AddPloy4(db, ptM.C2D(len), 1.25 * scale, 1.25 * scale, 2.5 * scale, ref ext, "H标注");
                TextPloter.AddDBText(db,ptM.C3D(len, -1.25 * scale), ref ext, "6", scale, 2.5 * 0.85, "SRB.HT", GeTools.DegreeToRadian(0), TextHorizontalMode.TextCenter, TextVerticalMode.TextVerticalMid);
            }
            #endregion

            #region N8
            TextPloter.AddDBText(db,pt.C2D(-pierPara.beam_l * 0.5 + sideL, -beamRebarPara.concrete_protect_layer).C3D(3 * scale, -hh * 0.7), ref ext, "8", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[8].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[8].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[8].C3D(radius, -radius + hh * 0.3), ref ext, "8", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[ptLst.Count - 9].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[ptLst.Count - 9].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[ptLst.Count - 9].C3D(-radius, -radius + hh * 0.3), ref ext, "8", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,pt.C2D(pierPara.beam_l * 0.5 - sideL, -beamRebarPara.concrete_protect_layer).C3D(-0 * scale, -hh * 0.7), ref ext, "8", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            #endregion

            #region N9

            PLPloter.AddLine(db,ptLst[4].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[4].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[4].C3D(-radius, -radius + hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[12].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[12].C2D(-radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[12].C3D(-radius, -radius + hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[16].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[16].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[16].C3D(radius, -radius + hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            PLPloter.AddLine(db,ptLst[ptLst.Count - 5].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer)), ptLst[ptLst.Count - 5].C2D(radius, -(sideLT - beamRebarPara.concrete_protect_layer) + hh), ref ext, "H钢筋");
            TextPloter.AddDBText(db,ptLst[ptLst.Count - 5].C3D(radius, -radius + hh * 0.7), ref ext, "9", scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);

            #endregion

            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-pierPara.beam_l * 0.5 + sideS + radius, -BeamH + sideB6),
            radius, ArrAlongL, scale, 0, out reLLst, false, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(pierPara.beam_l * 0.5 - sideS - radius, -BeamH + sideB6),
            radius, ArrAlongL, scale, 0, out reRLst, false, false, false);

            List<Point3d> lstN7 = new List<Point3d>();
            List<Point3d> lstN7a = new List<Point3d>();
            for (int i = 0; i < reLLst.Count; i++)
            {
                if (i < reLLst.Count - N7Half)
                {
                    lstN7a.Add(reLLst[i]);
                }
                else
                {
                    lstN7.Add(reLLst[i]);
                }
            }
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, lstN7, "7", lstN7.Count / 4, lstN7.Count / 4, scale, false, 5 * scale);
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_LEFT, lstN7a, "7a", lstN7a.Count / 4, lstN7a.Count / 4, scale, false, 5 * scale);

            lstN7 = new List<Point3d>();
            lstN7a = new List<Point3d>();
            for (int i = 0; i < reRLst.Count; i++)
            {
                if (i < reRLst.Count - N7Half)
                {
                    lstN7a.Add(reRLst[i]);
                }
                else
                {
                    lstN7.Add(reRLst[i]);
                }
            }
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_RIGHT, lstN7, "7", lstN7.Count / 4, lstN7.Count / 4, scale, false, 5 * scale);
            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_RIGHT, lstN7a, "7a", lstN7a.Count / 4, lstN7a.Count / 4, scale, false, 5 * scale);


            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, 0), pt.C3D(-pierPara.beam_l * 0.5, -sideLT), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH), pt.C3D(-pierPara.beam_l * 0.5, -BeamH + sideLB), ptDimR.C3D(-5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            string s = ArrAlongL[0].ToString("0.0") + "+" + (ArrAlongL.Count - 2) + "×" + ArrAlongL[1] + "+" + Math.Round(BeamH - Math.Round(ArrAlongL[0], 1) - (ArrAlongL.Count - 2) * ArrAlongL[1] - sideLT - sideLB, 1);

            DimPloter.DimRot(db, pt.C3D(-pierPara.beam_l * 0.5, -BeamH + sideLB), pt.C3D(-pierPara.beam_l * 0.5, -sideLT), ptDimR.C3D(-5 * scale), ref ext, 90, scale, s, Unit.Centimeter, Unit.Centimeter, 1);
            #endregion

            #region 大样

            #region N8,N9
            //double diaN8 = GeneralRebar.outerDiaNew[beamRebarPara.stirrup_reinforcement_diameter] * 0.1;
            double diaN8 = ((int)beamRebarPara.stirrup_reinforcement_diameter) * 0.1;
            Point2d ptS = pt.C2D(0, -ext.L() - 10 * scale);
            double le = pierPara.beam_l * 0.5 - sideS;
            double N810w = Math.Round(topSpaceLst[0] + topSpaceLst[1] * 7 + N1Dia + NSDia, 1);
            double N911w = Math.Round(topSpaceLst[1] * 12 + N1Dia + NSDia, 1);
            double N8Len = N810w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N89Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            Tuple<string, eDB, int, double, string, string> tu = new Tuple<string, eDB, int, double, string, string>("8", beamRebarPara.stirrup_reinforcement_diameter, N89 * 2, N8Len, N8Len.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);
            double N9Len = N911w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N89Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("9", beamRebarPara.stirrup_reinforcement_diameter, N89 * 2, N9Len, N9Len.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);

            Point2d ptCenter = ptS.C2D(-le + N810w * 0.5);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-1.5*scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 2), ptCenter.C2D(N810w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -2), ptCenter.C2D(N810w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N89Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(-2 * scale, -N89Len), ptCenter.C3D(0, -N89Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N8Len.ToString("0.0"), "8",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w * 0.5 + N911w * 0.5, 15 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 2), ptCenter.C2D(N911w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -2), ptCenter.C2D(N911w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N89Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N89Len * 0.3), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N9Len.ToString("0.0"), "9",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w + N911w / 3.0 + N911w * 0.5, 8 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5), ptCenter.C2D(N911w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 2), ptCenter.C2D(N911w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -2), ptCenter.C2D(N911w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2 * scale, -N89Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N9Len.ToString("0.0"), "9",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);


            ptCenter = ptS.C2D(-le + N810w * 1.5 + N911w);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N89Len, ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-1.5 * scale, -2 * scale), ref ext, "H钢筋");
            //PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5), ptCenter.C2D(N810w * 0.5).C2D(-2 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 2), ptCenter.C2D(N810w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -2), ptCenter.C2D(N810w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N89Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N89Len * 0.5), ref ext, N89Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N89Len), ptCenter.C3D(0, -N89Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), N8Len.ToString("0.0"), "8",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            #endregion

            #region N10,11
            ptS = pt.C2D(0, -ext.L() - 15 * scale);

            double N10Len = N810w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N1011Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("10", beamRebarPara.stirrup_reinforcement_diameter, N1011 * 2, N10Len, "均" + N10Len.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);
            double N11Len = N911w * 2 + GeneralRebar.outerDia135Hoke[beamRebarPara.stirrup_reinforcement_diameter] * 2 + N1011Len * 2 - 3 * GlobalFuncs.CalculateReduction(beamRebarPara.stirrup_reinforcement_diameter, 90);
            tu = new Tuple<string, eDB, int, double, string, string>("11", beamRebarPara.stirrup_reinforcement_diameter, N1011 * 2, N11Len, "均" + N11Len.ToString("0.0"), strDiameter);
            rebarLst.Add(tu);
            ptCenter = ptS.C2D(-le + N810w * 0.5);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 2), ptCenter.C2D(N810w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -2), ptCenter.C2D(N810w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N1011Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N1011Len), ptCenter.C3D(0, -N1011Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N10Len.ToString("0.0"), "10",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w * 0.5 + N911w * 0.5, 15 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 2), ptCenter.C2D(N911w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -2), ptCenter.C2D(N911w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2 * scale, -N1011Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N11Len.ToString("0.0"), "11",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);

            ptCenter = ptS.C2D(-le + N810w + N911w / 3.0 + N911w * 0.5, 8 * scale);
            PLPloter.AddPloy4(db, ptCenter, N911w * 0.5, N911w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5 - 2), ptCenter.C2D(N911w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N911w * 0.5, -2), ptCenter.C2D(N911w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N911w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(-2 * scale, -N1011Len), ref ext, N911w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N911w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(), ptCenter.C3D().C2D(2 * scale, 5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N11Len.ToString("0.0"), "11",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);


            ptCenter = ptS.C2D(-le + N810w * 1.5 + N911w);
            PLPloter.AddPloy4(db, ptCenter, N810w * 0.5, N810w * 0.5, N1011Len, ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5 - 2), ptCenter.C2D(N810w * 0.5 - 2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            PLPloter.AddLine(db,ptCenter.C2D(N810w * 0.5, -2), ptCenter.C2D(N810w * 0.5, -2).C2D(-1.5 * scale, -1.5 * scale), ref ext, "H钢筋");
            //TextPloter.AddDBText(db,ptCenter.C2D(N810w * 0.5).C3D(-3 * scale, -4.5 * scale), ref ext, "12", scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(0, -N1011Len), ref ext, N810w.ToString("0.0"), scale, 2.5, "SRB.HT", 0, TextHorizontalMode.TextCenter);
            //TextPloter.AddDBText(db,ptCenter.C3D(-N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            TextPloter.AddDBText(db,ptCenter.C3D(N810w * 0.5, -N1011Len * 0.5), ref ext, "均" + N1011Len.ToString("0.0"), scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90), TextHorizontalMode.TextCenter);
            RebarDimPloter.RebarWireNew(db, ref ext, ptCenter.C2D(0, -N1011Len), ptCenter.C3D(0, -N1011Len).C2D(2 * scale, -5 * scale), strDiameter + ((int)beamRebarPara.stirrup_reinforcement_diameter).ToString(), "均" + N10Len.ToString("0.0"), "10",
GeTools.DegreeToRadian(0), Extensions.curFont, scale);
            #endregion

            #endregion
        }



        public void RendeDetail(ref Database db, out Extents2d ext, Point2d insertPoint, int scale = 1)
        {

            Point2d CT = insertPoint;
            Point2d M1 = CT.C2D(0, -2 * scale);
            ext = new Extents2d(insertPoint, insertPoint);

            List<string> list = new List<string>();
            list.Add("编号");
            list.Add("直径\\P(mm)");
            list.Add("单根长\\P(cm)");
            list.Add("根数");
            list.Add("总长\\P(m)");
            list.Add("单位重\\P(kg/m)");
            list.Add("总重\\P(kg)");
            list.Add("合计(kg)");
            double height = 0;
            double width = 0;
            double volumn = pierPara.beam_w * 0.01 * pierPara.beam_l * 0.01 * (pierPara.h4 - pierPara.h3) - pierPara.beam.beam_w*0.01 * ((pierPara.h4 - pierPara.h3)-pierPara.beam.beam_h * 0.01)* pierPara.beam_l * 0.01;
            List<Point2d> ptLst = new List<Point2d>();
            PierModelTablePloter.DrawBeamRebarTable(db, ref ext, M1.C3D(), rebarLst, list, rebarLst.Count + 1+1, list.Count, ref height, ref width, Extensions.curFont, scale, beamRebarPara.reinforcement_grade, volumn, beamRebarPara.concrete_no+ "混凝土(m³)");
            double ActualWidth = 0, ActualHeight = 0;
            MText txt = TextPloter.GetTextActualWidth(db, "单个盖梁钢筋混凝土明细表", scale, out ActualWidth, out ActualHeight, 4);
            TextPloter.AddMText(db,M1.C3D((width - ActualWidth) / 2, ActualHeight + scale * 2), ref ext, "单个盖梁钢筋混凝土明细表", scale, 4, ActualWidth + 2*scale, Extensions.curFont);

            List<string> list1 = new List<string>();
            list1.Add("名称及规格");
            list1.Add("名称及规格");
            list1.Add("单位");
            list1.Add("总重");
            list1.Add("合计");
            double height1 = 0;
            double width1 = 0;          
            txt = TextPloter.GetTextActualWidth(db, "盖梁材料数量表(全桥" + beamRebarPara.structure_number + "个)", scale, out ActualWidth, out ActualHeight, 4);
            if(beamRebarPara.reinforcement_grade== "HRB650E")
            PierModelTablePloter.DrawBeamMaterialsTable(db, ref ext, M1.C3D(0, -height - ActualHeight * 3), rebarLst, list1, beamRebarPara.structure_number, volumn, list1.Count, ref height1, ref width1, Extensions.curFont, scale, beamRebarPara.reinforcement_grade, beamRebarPara.main_reinforcement_grade, beamRebarPara.main_top_reinforcement_diameter.ToString()+","+ beamRebarPara.main_bottom_reinforcement_diameter.ToString(), beamRebarPara.concrete_no);
            else
                PierModelTablePloter.DrawBeamMaterialsTable(db, ref ext, M1.C3D(0, -height - ActualHeight * 3), rebarLst, list1, beamRebarPara.structure_number, volumn, list1.Count, ref height1, ref width1, Extensions.curFont, scale, beamRebarPara.reinforcement_grade, beamRebarPara.main_reinforcement_grade, beamRebarPara.main_top_reinforcement_diameter.ToString() + "," + beamRebarPara.main_bottom_reinforcement_diameter.ToString(), beamRebarPara.concrete_no);
            TextPloter.AddMText(db,M1.C3D((width1 - ActualWidth) / 2, -height - ActualHeight - scale * 2), ref ext, "盖梁材料数量表(全桥" + beamRebarPara.structure_number + "个)", scale, 4, ActualWidth + 1 * scale, Extensions.curFont);

            // 文字
            //string text = "注";
            //Point3d p1 = M1.C3D(0, -height - ActualHeight * 3-15*scale);
            //TextPloter.AddMText(db,p1, ref ext, text, scale, 2.5, 50, Extensions.curFont);

            string text = @"注
  1.本图尺寸除钢筋直径以毫米计外，余均以厘米为单位。
  2.在盖梁端头将上下相应位置的N1与N6，N1与N2，N3、N4、N5与N2、N6焊接，\P  采用双面焊，焊缝长度不得小于5d。
  3.图中未示出挡块和支座垫石钢筋构造，详见支座垫石与挡块构图。
  4.盖梁钢筋如与墩身钢筋冲突,可适当调整盖梁钢筋以保证桥墩钢筋位置准确。
  5.本图适用于" + beamRebarPara.pier_name + "墩。"; 
            Point3d p2 = M1.C3D(0, -height- height1 - ActualHeight * 3 - 8.5 * scale);
            TextPloter.AddMText(db,p2, ref ext, text, scale, 3, 140 * scale, Extensions.curFont);

            try
            {
                BatchInsertQuentity(rebarLst, volumn);
            }
            catch (Exception ex)
            {

            }
        }



        private void BatchInsertQuentity(List<Tuple<string, eDB, int, double, string, string>> rebarLst, double volumn)
        {
            List<string> sqlList = new List<string>();
            if (rebarLst.Count > 0)
            {
                eDB mainDia = beamRebarPara.main_bottom_reinforcement_diameter;
                eDB mainTopDia = beamRebarPara.main_top_reinforcement_diameter;
                string main_reinforcement_grade = beamRebarPara.main_reinforcement_grade;
                string reinforcement_grade = beamRebarPara.reinforcement_grade;
                string delSql = "delete from busi_engineering_quantity where  bridge_id='" + bridgeId + "' and (portable_belong_part=6 or belong_part=6) ";
                #region 数据合并
                // 数据合并
                Dictionary<string, List<int>> dic = new Dictionary<string, List<int>>();
                for (int i = 0; i < rebarLst.Count; ++i)
                {
                    string strNo = rebarLst[i].Item2.ToString();
                    if (dic.Count == 0)
                    {
                        List<int> list = new List<int>();
                        list.Add(i);
                        dic.Add(strNo, list);
                    }
                    else
                    {
                        if (!dic.ContainsKey(strNo))
                        {
                            List<int> list = new List<int>();
                            list.Add(i);
                            dic.Add(strNo, list);
                        }
                        else
                        {
                            List<int> list = new List<int>();
                            dic.TryGetValue(strNo, out list);
                            list.Add(i);
                            dic[strNo] = list;
                        }
                    }
                }
                dic = dic.OrderByDescending(f => f.Key).ToDictionary(f => f.Key, f => f.Value);
                #endregion

                string remark = "盖梁钢筋";
                string material = "钢筋";
                string materialCode = main_reinforcement_grade;
                string materielSpecs = mainDia.ToString();


                double allWeight = 0;
                int count = beamRebarPara.structure_number;
                int totalCap = 0;
                int totalTopCap = 0;
                foreach (KeyValuePair<string, List<int>> pr in dic)
                {
                    string strNo = "钢筋";
                    string unit = "kg";
                    eDB diameter = eDB.None;
                    double totallength = 0;
                    // 设置表数据
                    for (int i = 0; i < pr.Value.Count; ++i)
                    {
                        // 钢筋编号
                        diameter = rebarLst[pr.Value[i]].Item2;                         // 直径
                        totallength += rebarLst[pr.Value[i]].Item3 * rebarLst[pr.Value[i]].Item4;

                    }
                    double weight = GlobalFuncs.GetUnitWeight(diameter);
                    double totalWeight = totallength * 0.01 * weight;

                    allWeight += totalWeight * count;
                    string strDiameter = "Ф" + (int)diameter;

                    remark = "盖梁钢筋";
                    material = "钢筋";
                    materialCode = main_reinforcement_grade;
                    materielSpecs = diameter.ToString();
                    if (diameter == mainDia || diameter == mainTopDia)
                    {
                        materialCode = main_reinforcement_grade;

                    }
                    else
                        materialCode = reinforcement_grade;
                    string id = Guid.NewGuid().ToString();
                    string sql = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "unit_weight,total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','kg','"
                        + weight + "','" + allWeight + "','2','3','3','" + remark + "')";
                    sqlList.Add(sql);
                }



                material = "混凝土";
                materialCode = material;
                materielSpecs = beamRebarPara.concrete_no;
                remark = "盖梁混凝土";
                string id1 = Guid.NewGuid().ToString();
                string sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                    + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                    + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','m3','"
                    + volumn * count + "','2','3','3','" + remark + "')";
                sqlList.Add(sqlIn);



                if (totalCap > 0)
                {
                    material = "钢筋连接器";
                    materialCode = material;
                    materielSpecs = mainDia.ToString();
                    remark = "盖梁钢筋连接器";
                    id1 = Guid.NewGuid().ToString();
                    sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','个','"
                        + totalCap * count + "','2','3','3','" + remark + "')";
                    sqlList.Add(sqlIn);
                }
                if (totalTopCap > 0)
                {
                    material = "钢筋连接器";
                    materialCode = material;
                    materielSpecs = mainDia.ToString();
                    remark = "盖梁钢筋连接器";
                    id1 = Guid.NewGuid().ToString();
                    sqlIn = "insert into busi_engineering_quantity(id,bridge_id,materiel,materiel_code,materiel_specs,unit,"
                        + "total_weight,is_auto,belong_part,portable_belong_part,remark)"
                        + "values('" + id1 + "','" + bridgeId + "','" + material + "','" + materialCode + "','" + materielSpecs + "','个','"
                        + totalTopCap * count + "','2','3','3','" + remark + "')";
                    sqlList.Add(sqlIn);
                }
            }

        }


    }

}
